﻿using System;
using System.Collections.Generic;
using Acaweb.Data.Contracts;
using Acaweb.Model.Entities;
using Acaweb.Model.Entities.DatosCompuestos;
using Spring.Transaction.Interceptor;
using System.Linq;

namespace Acaweb.Data.Dao.NHibernate
{
    public class PaisesDao : HibernateDao<Paises, int>, IPaisesDao
    {
        [Transaction(ReadOnly = true)]
        public IList<Paises> GetAll()
        {
            return GetAll<Paises>();
        }

        public Paises GetByNombre(string Nombre)
        {
            if (string.IsNullOrEmpty(Nombre))
                Nombre = "COLOMBIA";

            return Session.QueryOver<Paises>().Where(t => t.Nombre == Nombre).List().First();
        }
    }
}
